package com.xrkol.sharelib.entity;

import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;

/**
 * 监护人
 * 
 * @author peng.xia
 * 
 */
@Entity
@Table
public class User extends BasicEntity implements WeixinStatusAvilable{

    private static final long serialVersionUID = 1L;

    @Id
    @GenericGenerator(name = "hibernate-uuid", strategy = "uuid")
    @GeneratedValue(generator = "hibernate-uuid")
    private String id;

    private String name;

    private String phone;

    private String userId;

    private String weiXin;
    
    private String email;
    
    @ManyToOne
    private Shop shop;

    /**
     * 头像
     */
    @Lob
    private String avatar;

//    private boolean subscribed = false;
    
    @Enumerated(EnumType.STRING)
    private WeixinStatus weixinStatus = WeixinStatus.NOT_CREATED;
    
    public User(){
        
    }

    @Override
    public WeixinStatus getWeixinStatus() {
        return this.weixinStatus;
    }
    
    public void setWeixinStatus(WeixinStatus weixinStatus) {
        this.weixinStatus = weixinStatus;
    }
    
    
    public boolean isSubscribed() {
        return this.weixinStatus == WeixinStatus.SUBSCRIBED;
    }

    public String getWeiXin() {
        return weiXin;
    }

    public void setWeiXin(String weiXin) {
        this.weiXin = weiXin;
    }

    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getUserId() {
        return userId;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
    
    public String getEmail() {
        return email;
    }
    
    public void setEmail(String email) {
        this.email = email;
    }
}
